home *** CD-ROM | disk | FTP | other *** search
- Path: csun.edu!kc44097
- From: kc44097@csun.edu (chen)
- Newsgroups: comp.lang.c
- Subject: Beginner need help??????????????
- Date: 9 Apr 1996 21:53:06 GMT
- Organization: California State University, Northridge
- Message-ID: <4kem82$5j3@dewey.csun.edu>
- NNTP-Posting-Host: louie.csun.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- I am a new comer of C language and I use Boland C++ 3.1 as
- my compiler.These days I found some wierd things happens.I do not
- know is cause by my compiler or is the restriction of the language
- itself.Can anyone give me some advice.Please e-mail me
-
- My e-mail is kc44097@huey.csun.edu
-
- Thankx !
-
-
-
- -------- program 1 -------------------------
- #include <stdio.h>
-
- float answer;
-
- main ()
- {
- answer = 1 / 3;
- printf("The value of 1/3 is %f\n",
- answer);
-
- return(0);
- }
-
-
- ????? The answer should be 0.333333 but compiler give me 0.000000 ??????
-
- ----------program 2----------------------------
- #include <stdio.h>
-
- float result;
-
-
- main()
- {
- result = 7.0 / 22.0;
-
- printf("The result is %d\n", result);
- return (0);
- }
-
- ???? The answer should be 0.31818 but compiler give me 0 ????
-
- ----------program 3---------------------------
- #include <stdio.h>
-
- int integer;
- float floating;
-
-
- main()
- {
- floating = 7.0 / 22.0;
-
- integer = floating;
-
- printf("The value of integer is %f\n", integer);
- return (0);
- }
-
- ???? The answer should be 0.31818 but compiler give me 0.000000 ?????
-